class DirectSingleButton extends eui.Component implements eui.UIComponent {

    public constructor() {
        super();
        this.skinName = new ui.directButton();
        this.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touchEventHandler, this);
        this.addEventListener(egret.TouchEvent.TOUCH_END, this.touchEventHandler, this);
    }

    private isTouchDown:boolean = false;

    private touchEventHandler(e:egret.TouchEvent) {
        switch (e.type) {
            case egret.TouchEvent.TOUCH_BEGIN: {
                this.isTouchDown = true;
                break;
            }
            case egret.TouchEvent.TOUCH_END: {
                this.isTouchDown = false;
                break;
            }
        }
        this.invalidateState();
    }

    protected getCurrentState():string {
        if(this.isTouchDown) {
            return 'down';
        }
        return 'up';
    }
}